package com.x.Servlet_12_Listener;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * ClassName: Servlet3
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.08.30 16:15
 */

@WebServlet("/removeListener")
public class Servlet3 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //删除应用域中的数据
        ServletContext app = this.getServletContext();
        app.removeAttribute("key01");
    }
}
